<#--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
-->
<#assign docLangAttr = locale.toString()?replace("_", "-")>
<#assign langDir = "ltr">
<#if "ar.iw"?contains(docLangAttr?substring(0, 2))>
    <#assign langDir = "rtl">
</#if>
<html lang="${docLangAttr}" dir="${langDir}" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>${layoutSettings.companyName}: <#if (page.titleProperty)?has_content>${uiLabelMap[page.titleProperty]}<#else>${(page.title)?if_exists}</#if></title>
    <#if layoutSettings.shortcutIcon?has_content>
      <#assign shortcutIcon = layoutSettings.shortcutIcon/>
    <#elseif layoutSettings.VT_SHORTCUT_ICON?has_content>
      <#assign shortcutIcon = layoutSettings.VT_SHORTCUT_ICON.get(0)/>
    </#if>
    <#if shortcutIcon?has_content>
      <link rel="shortcut icon" href="<@ofbizContentUrl>${StringUtil.wrapString(shortcutIcon)}</@ofbizContentUrl>" />
    </#if>
    <#if layoutSettings.javaScripts?has_content>
        <#--layoutSettings.javaScripts is a list of java scripts. -->
        <#-- use a Set to make sure each javascript is declared only once, but iterate the list to maintain the correct order -->
        <#assign javaScriptsSet = Static["org.ofbiz.base.util.UtilMisc"].toSet(layoutSettings.javaScripts)/>
        <#list layoutSettings.javaScripts as javaScript>
            <#if javaScriptsSet.contains(javaScript)>
                <#assign nothing = javaScriptsSet.remove(javaScript)/>
                <script src="<@ofbizContentUrl>${StringUtil.wrapString(javaScript)}</@ofbizContentUrl>" type="text/javascript"></script>
            </#if>
        </#list>
    </#if>
    <#if layoutSettings.VT_HDR_JAVASCRIPT?has_content>
        <#list layoutSettings.VT_HDR_JAVASCRIPT as javaScript>
            <script src="<@ofbizContentUrl>${StringUtil.wrapString(javaScript)}</@ofbizContentUrl>" type="text/javascript"></script>
        </#list>
    </#if>
    <#if layoutSettings.styleSheets?has_content>
        <#--layoutSettings.styleSheets is a list of style sheets. So, you can have a user-specified "main" style sheet, AND a component style sheet.-->
        <#list layoutSettings.styleSheets as styleSheet>
            <link rel="stylesheet" href="<@ofbizContentUrl>${StringUtil.wrapString(styleSheet)}</@ofbizContentUrl>" type="text/css"/>
        </#list>
    </#if>
    <#if layoutSettings.VT_STYLESHEET?has_content>
        <#list layoutSettings.VT_STYLESHEET as styleSheet>
            <link rel="stylesheet" href="<@ofbizContentUrl>${StringUtil.wrapString(styleSheet)}</@ofbizContentUrl>" type="text/css"/>
        </#list>
    </#if>
    <#if layoutSettings.rtlStyleSheets?has_content && langDir == "rtl">
        <#--layoutSettings.rtlStyleSheets is a list of rtl style sheets.-->
        <#list layoutSettings.rtlStyleSheets as styleSheet>
            <link rel="stylesheet" href="<@ofbizContentUrl>${StringUtil.wrapString(styleSheet)}</@ofbizContentUrl>" type="text/css"/>
        </#list>
    </#if>
    <#if layoutSettings.VT_RTL_STYLESHEET?has_content && langDir == "rtl">
        <#list layoutSettings.VT_RTL_STYLESHEET as styleSheet>
            <link rel="stylesheet" href="<@ofbizContentUrl>${StringUtil.wrapString(styleSheet)}</@ofbizContentUrl>" type="text/css"/>
        </#list>
    </#if>
    <#if layoutSettings.VT_EXTRA_HEAD?has_content>
        <#list layoutSettings.VT_EXTRA_HEAD as extraHead>
            ${extraHead}
        </#list>
    </#if>
    <#if lastParameters?exists><#assign parametersURL = "&amp;" + lastParameters></#if>
    <#if layoutSettings.WEB_ANALYTICS?has_content>
      <script language="JavaScript" type="text/javascript">
        <#list layoutSettings.WEB_ANALYTICS as webAnalyticsConfig>
          ${StringUtil.wrapString(webAnalyticsConfig.webAnalyticsCode?if_exists)}
        </#list>
      </script>
    </#if>
</head>
<#if layoutSettings.headerImageLinkUrl?exists>
  <#assign logoLinkURL = "${layoutSettings.headerImageLinkUrl}">
<#else>
  <#assign logoLinkURL = "${layoutSettings.commonHeaderImageLinkUrl}">
</#if>
<#assign organizationLogoLinkURL = "${layoutSettings.organizationLogoLinkUrl?if_exists}">

<#if (requestAttributes.externalLoginKey)?exists><#assign externalKeyParam = "?externalLoginKey=" + requestAttributes.externalLoginKey?if_exists></#if>
<#if (externalLoginKey)?exists><#assign externalKeyParam = "?externalLoginKey=" + requestAttributes.externalLoginKey?if_exists></#if>
<#assign ofbizServerName = application.getAttribute("_serverId")?default("default-server")>
<#assign contextPath = request.getContextPath()>
<#assign displayApps = Static["org.ofbiz.webapp.control.LoginWorker"].getAppBarWebInfos(security, userLogin, ofbizServerName, "main")>
<#assign displaySecondaryApps = Static["org.ofbiz.webapp.control.LoginWorker"].getAppBarWebInfos(security, userLogin, ofbizServerName, "secondary")>

<#assign appModelMenu = Static["org.ofbiz.widget.menu.MenuFactory"].getMenuFromLocation(applicationMenuLocation,applicationMenuName,delegator,dispatcher)>
<#if appModelMenu.getModelMenuItemByName(headerItem)?exists>
  <#if headerItem!="main">
    <#assign show_last_menu = true>
  </#if>
</#if>

<#if parameters.portalPageId?exists && !appModelMenu.getModelMenuItemByName(headerItem)?exists>
  <#assign show_last_menu = true>
</#if>


<body class="skin-blue">
 <!-- header logo: style can be found in header.less -->
        <header class="header">
              <#if layoutSettings.headerImageUrl?exists>
		        <#assign headerImageUrl = layoutSettings.headerImageUrl>
		      <#elseif layoutSettings.commonHeaderImageUrl?exists>
		        <#assign headerImageUrl = layoutSettings.commonHeaderImageUrl>
		      <#elseif layoutSettings.VT_HDR_IMAGE_URL?exists>
		        <#assign headerImageUrl = layoutSettings.VT_HDR_IMAGE_URL.get(0)>
		      </#if>
		      <#if headerImageUrl?exists>
		        <#if organizationLogoLinkURL?has_content>
		            <a href="<@ofbizUrl>${logoLinkURL}</@ofbizUrl>" class="logo"><img alt="${layoutSettings.companyName}" src="<@ofbizContentUrl>${StringUtil.wrapString(organizationLogoLinkURL)}</@ofbizContentUrl>"></a>
		            <#else>
		            <a href="<@ofbizUrl>${logoLinkURL}</@ofbizUrl>" class="logo"><img alt="${layoutSettings.companyName}" src="<@ofbizContentUrl>${StringUtil.wrapString(headerImageUrl)}</@ofbizContentUrl>"/></a>
		        </#if>
		      </#if>
            <!-- Header Navbar: style can be found in header.less -->
            <nav class="navbar navbar-static-top" role="navigation">
                <!-- Sidebar toggle button-->
                <a href="#" class="navbar-btn sidebar-toggle" data-toggle="offcanvas" role="button">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </a>
                <a href="#" class="navbar-btn sidebar-toggle" data-toggle="dropdown" role="button">
                    <span class="label">Application <i class="caret"></i></span>
                </a>
                <ul class="dropdown-menu">
                    <li class="header-nav">
                      <ul>
                        <li><h3>Primary Apps</h3></li>
                        <#list displayApps as display>
                          <#assign thisApp = display.getContextRoot()>
                          <#assign selected = false>
                          <#if thisApp == contextPath || contextPath + "/" == thisApp>
                            <#assign selected = true>
                          </#if>
                          <#assign thisApp = StringUtil.wrapString(thisApp)>
                          <#assign thisURL = thisApp>
                          <#if thisApp != "/">
                            <#assign thisURL = thisURL + "/control/main">
                          </#if>
                          <#if layoutSettings.suppressTab?exists && display.name == layoutSettings.suppressTab>
                            <!-- do not display this component-->
                          <#else>
                            <li<#if selected> class="active"</#if>><a href="${thisURL + externalKeyParam}"<#if uiLabelMap?exists> title="${uiLabelMap[display.description]}">${uiLabelMap[display.title]}<#else> title="${display.description}">${display.title}</#if></a></li>
                          </#if>
                        </#list>
                      </ul>
                      <ul>
                        <li><h3>Secondary Apps</h3></li>
                        <#list displaySecondaryApps as display>
                          <#assign thisApp = display.getContextRoot()>
                          <#assign selected = false>
                          <#if thisApp == contextPath || contextPath + "/" == thisApp>
                            <#assign selected = true>
                          </#if>
                          <#assign thisApp = StringUtil.wrapString(thisApp)>
                          <#assign thisURL = thisApp>
                          <#if thisApp != "/">
                            <#assign thisURL = thisURL + "/control/main">
                          </#if>
                          <#if layoutSettings.suppressTab?exists && display.name == layoutSettings.suppressTab>
                            <!-- do not display this component-->
                          <#else>
                              <li<#if selected> class="active"</#if>><a href="${thisURL + externalKeyParam}"<#if uiLabelMap?exists> title="${uiLabelMap[display.description]}">${uiLabelMap[display.title]}<#else> title="${display.description}">${display.title}</#if></a></li>
                          </#if>
                        </#list>
                      </ul>
                     </li>
                </ul>
                <div class="navbar-right">
                    <ul class="nav navbar-nav">
                        <!-- User Account: style can be found in dropdown.less -->
                        
                        <li class="dropdown tasks-menu">
                            <a href="<@ofbizUrl>ListTimezones</@ofbizUrl>">
                                <span class="time"><i class="fa fa-clock-o"></i> ${nowTimestamp?datetime?string.short}</span>
                            </a>
                        </li>
                        <li class="dropdown tasks-menu">
                            <a href="<@ofbizUrl>ListLocales</@ofbizUrl>">
                                <span class="time"><i class="fa fa-flag"></i> ${locale.getDisplayName(locale)}</span>
                            </a>
                        </li>
                        <li class="dropdown tasks-menu">
                            <a href="<@ofbizUrl>ListVisualThemes</@ofbizUrl>">
                                <span class="time"><i class="fa fa-gear"></i> ${uiLabelMap.CommonVisualThemes}</span>
                            </a>
                        </li>

                        
                        
                        <li class="dropdown messages-menu">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                                <i class="fa fa-envelope"></i>
                                <span class="label label-success"><#if layoutSettings.middleTopMessage1?has_content && layoutSettings.middleTopMessage1 != " ">1</#if></span>
                            </a>
                            <#if layoutSettings.middleTopMessage1?has_content && layoutSettings.middleTopMessage1 != " ">
                            <ul class="dropdown-menu">
                            	
                                <li class="header">${layoutSettings.middleTopHeader?if_exists}</li>
                                <li>
                                    <!-- inner menu: contains the actual data -->
                                    <ul class="menu">
									  	<li>
									        <a href="${layoutSettings.middleTopLink1?if_exists}">
									        	<p>${layoutSettings.middleTopMessage1?if_exists}</p>
									        </a>
                                        </li>
                                        <li>
									        <a href="${layoutSettings.middleTopLink2?if_exists}">
									        	<p>${layoutSettings.middleTopMessage2?if_exists}</p>
									        </a>
                                        </li>
                                        <li>
									        <a href="${layoutSettings.middleTopLink3?if_exists}">
									        	<p>${layoutSettings.middleTopMessage3?if_exists}</p>
									        </a>
                                        </li>
                                    </ul>
                                </li>
                                <li class="footer"><a href="#">See All Messages</a></li>
                               
                            </ul>
                            </#if>
                        </li>
						<#if userLogin?exists>          
                        <li class="dropdown user user-menu">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                                <i class="glyphicon glyphicon-user"></i>
                                <span>${userLogin.userLoginId}<i class="caret"></i></span>
                            </a>
                            <ul class="dropdown-menu">
                                <!-- User image -->
                                <li class="user-header bg-light-blue">
                                    <img src="<@ofbizContentUrl>/adminlte/images/avatar5.png</@ofbizContentUrl>" class="img-circle" alt="User Image" />
                                    <p>
                                        Jane Doe - Web Developer
                                        <small>Member since Nov. 2012</small>
                                    </p>
                                </li>
                                <!-- Menu Body -->
                                <li class="user-body">
                                    <div class="col-xs-4 text-center">
                                        <a href="#">Followers</a>
                                    </div>
                                    <div class="col-xs-4 text-center">
                                        <a href="#">Sales</a>
                                    </div>
                                    <div class="col-xs-4 text-center">
                                        <a href="#">Friends</a>
                                    </div>
                                </li>
                                <!-- Menu Footer-->
                                <li class="user-footer">
                                    <div class="pull-right">
                                        <a href="<@ofbizUrl>logout</@ofbizUrl>" class="btn btn-default btn-flat">${uiLabelMap.CommonLogout}</a>
                                    </div>
                                </li>
                            </ul>
                        </li>
                        </#if>
                    </ul>
                </div>
            </nav>
        </header>
  <div class="wrapper row-offcanvas row-offcanvas-left ">
  <#--<br class="clear" />-->
